package view;

import tree.LeafKind;
import h2d.Flow;
import h2d.domkit.Style;
import h2d.domkit.Object;
import view.View_Menu;
import view.View_Aide;
import view.View_Layer;
import view.View_Tool;
import view.View_Canvas;
import view.View_Timeline;

@:uiComp("view-main")
class ViewMainComp extends Flow implements Object {
    static var SRC = 
    <view-main>
        <flow layout = "horizontal">
            <view-menu public id = "view_menu" ></view-menu>
            <flow layout = "vertical">
                <view-aide public id = "view_aide"></view-aide>
                <view-tool public id = "view_tool"></view-tool>
            </flow>
            <flow layout = "vertical">
                <view-timeline public id = "view_timeline"></view-timeline>
                
                <flow layout = "horizontal">
                    <view-canvas public id = "view_canvas"></view-canvas>
                    <view-layer public id = "view_layer"></view-layer>
                </flow>
            </flow>
        </flow>
    </view-main>

    
    public function new(?parent) {
		super(parent);
		initComponent();
	}
    
}

class View_Main extends ViewTress<ViewMainComp>{
    public function new(?view : ViewMainComp) {
        super(ViewMainComp, view);
        
        AddLeaf(VMenu, new View_Menu(m_view.view_menu));
        AddLeaf(VAide, new View_Aide(m_view.view_aide));
        AddLeaf(VTool, new View_Tool(m_view.view_tool));
        AddLeaf(VTimeline, new View_Timeline(m_view.view_timeline));
        AddLeaf(VCanvas, new View_Canvas(m_view.view_canvas));
        AddLeaf(VLayer, new View_Layer(m_view.view_layer));

        m_isSingleLeafUpdate = false;
    }
    public override function OnEnter(last:LeafKind) {
        super.OnEnter(last);
        var keys = m_leafMap.keys();
        for (key in keys){
            PushLeaf(key);
        }
        
	}
    
}